#include "Heap.h"

void TestHeap1()
{
	int array[] = { 27, 15, 19, 18, 28, 34, 65, 49, 25, 37 };
	HP hp;
	HeapInit(&hp);
	for (int i = 0; i < sizeof(array) / sizeof(int); ++i)
	{
		HeapPush(&hp, array[i]);
	}
	HeapPrint(&hp);

	// topK 
	int k = 5;
	while (k--)
	{
		printf("%d ", HeapTop(&hp));
		HeapPop(&hp);
	}

	HeapDestroy(&hp);
}

void TestHeap2()
{
	int array[] = { 27, 15, 19, 18, 28, 34, 65, 49, 25, 37 };
	HP hp;
	HeapInit(&hp);
	
	HeapCreate(&hp, array, sizeof(array)/sizeof(array[0]));

	HeapPrint(&hp);

	HeapDestroy(&hp);
}
//
//int TreeLeafSize(BTNode* root)
//{
//	if (root == NULL)
//	{
//		return 0;
//	}
//
//	if (root->left == NULL && root->right == NULL)
//	{
//		return 1;
//	}
//
//	return TreeLeafSize(root->left) + TreeLeafSize(root->right);
//
//}

//int TreeHeight(BTNode* root)
//{
//	if (root == 0)
//		return 0;
//
//	int rightlen = TreeHeight(root->right);
//	int leftlen = TreeHeight(root->left);
//
//	return rightlen > leftlen ? rightlen + 1 : leftlen + 1;
//}
//

int main()
{
	TestHeap2();

	return 0;

}